package df.car3.carcell.controller;

import df.car3.carcell.model.DfCustom;
import df.car3.carcell.service.DfCustomService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("custom")
public class DfCustomController {


    @Autowired
    private DfCustomService dfCustomService;


    @RequestMapping("create")
    public DfCustom create(DfCustom dfCustom){
        DfCustom dfCustomCreated = this.dfCustomService.create(dfCustom);
        return dfCustomCreated;
    }


    @RequestMapping("findAll")
    public List<DfCustom> findAll(){
        List<DfCustom> all = this.dfCustomService.findAll();
        return all;
    }

    @RequestMapping("findOne")
    public DfCustom findOne(Long id){
        DfCustom dfCustom = this.dfCustomService.findOne(id);
        return dfCustom;
    }

    @RequestMapping("update")
    public boolean update(DfCustom dfCustom){
        boolean flag = this.dfCustomService.update(dfCustom);
        return flag;
    }

    @RequestMapping("delete")
    public boolean create(Long id){
        boolean flag  = this.dfCustomService.delete(id);
        return flag;
    }

}
